<template>
  <div>
    <table>
      <tr>
        <td>编号</td>
        <td>图书名称</td>
        <td>作者</td>
        <td>出版社</td>
      </tr>
      <tr v-for="item in books">
        <td>{{item.id}}</td>
        <td>{{item.name}}</td>
        <td>{{item.author}}</td>
        <td>{{item.publish}}</td>
      </tr>
    </table>
  </div>
</template>

<script>
export default {
  name: "Book",
  data() {
    return {
      msg: 'Hello Vue',
      books: [
        {
          id: 1,
          name: '解忧杂货店',
          author: '东野圭吾',
          publish: '电子工业出版社'
        }
      ]
    }
  },
  /*初始化方法*/
  created () {
    const _this = this
    axios.get('http://localhost:8081/book/list').then(function (resp) {
      _this.books = resp.data
    })
  }
}
</script>

<style scoped>

</style>
